package top.wardyan.wmes.rfid.pub;

import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jfinal.core.ActionKey;
import com.jfinal.core.Path;

import top.wardyan.common.ctrl.BaseController;
import top.wardyan.wmes.rfid.kqa.dto.SystemUserInfoDto;
import top.wardyan.wmes.rfid.kqa.vo.BaseRequest;
import top.wardyan.wmes.rfid.kqa.vo.BaseResponse;

/**
 * @author lcf
 * @CreateTime 2022/1/19 13:58
 * @Description 中间件系统用户
 */
@Path("/system-user-info/")
@SuppressWarnings("unchecked")
public class SystemUserInfoController extends BaseController {
	private static final cn.hutool.log.Log log = cn.hutool.log.Log.get();
	
	@ActionKey("/system-user-info/add")
    public void addSystemUserInfo( ){
        BaseRequest<SystemUserInfoDto> params = this.getJson(BaseRequest.class);
  		if(log.isInfoEnabled()) {
  			log.info("新增系统管理员账号,请求参数为:" + JSONObject.toJSONString(params));
  		}
  		BaseResponse<SystemUserInfoDto> response = new BaseResponse<>();
  		String s = "{\"loginName\":\"string\",\"loginPass\":\"string\",\"remark\":\"string\",\"userID\":0,\"userName\":\"string\",\"userType\":0}";
  		SystemUserInfoDto dto = JSONObject.parseObject(s, SystemUserInfoDto.class);
  		response.setData(dto);
  		this.renderJson(response);
    }
	
	
	
	
	
	
	@ActionKey("/system-user-info/delete")
    public void delSystemUserInfo(){
        BaseRequest<Integer> params = this.getJson(BaseRequest.class);
  		if(log.isInfoEnabled()) {
  			log.info("删除系统管理员账号,请求参数为:" + JSONObject.toJSONString(params));
  		}
  		BaseResponse<String> response = new BaseResponse<>();
  		response.setSuccess("OK");
  		this.renderJson(response);
    }
	
	
	
	
	@ActionKey("/system-user-info/update")
    public void updateSystemUserInfo(){
        BaseRequest<SystemUserInfoDto> params = this.getJson(BaseRequest.class);
  		if(log.isInfoEnabled()) {
  			log.info("更新系统管理员账号,请求参数为:" + JSONObject.toJSONString(params));
  		}
  		BaseResponse<String> response = new BaseResponse<>();
  		response.setSuccess("OK");
  		this.renderJson(response);
    }
	
	
	
	
	
	
	@ActionKey("/system-user-info/get-user-list")
    public void getSysUserList(){
//        //log.info("获取所有系统管理员账号列表，请求参数为：" + JSONObject.toJSON(request).toString());
//        BaseResponse<List<SystemUserInfoDto>> response = new BaseResponse<>();
////        List<SystemUserInfoDto> dtoList = systemUserInfoService.getList();
////        response.setCode(200);
////        response.setData(dtoList);
//        this.renderJson(response);
		

        BaseRequest<Object> params = this.getJson(BaseRequest.class);
  		if(log.isInfoEnabled()) {
  			log.info("获取所有系统管理员账号列表,请求参数为:" + JSONObject.toJSONString(params));
  		}
  		BaseResponse<List<SystemUserInfoDto>> response = new BaseResponse<>();
  		String s = "[{\"loginName\":\"string\",\"loginPass\":\"string\",\"remark\":\"string\",\"userID\":0,\"userName\":\"string\",\"userType\":0}]";
  		List<SystemUserInfoDto> dto = JSONArray.parseArray(s, SystemUserInfoDto.class);
  		response.setData(dto);
  		this.renderJson(response);
    }

}
